@extends('admin.layouts.index')
@section('title', '用户会员列表-天天外链')
@section('content')
<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-body">
                @if(Auth::user()->authority == 3)
                <form class="m-search" method="GET" action="{{ URL::current() }}">
                    <div class="m-search-items">
                        <div class="m-search-item">
                            <label>会员类型</label>
                            <select name="product_id">
                                <option value="">全部类型</option>
                                <option value="2">基础版</option>
                                <option value="3">高级版</option>
                                <option value="4">企业版</option>
                            </select>
                        </div>
                        <div class="m-search-item">
                            <label>支付状态</label>
                            <select name="pay_status">
                                <option value="2">待支付</option>
                                <option value="3" selected="">已支付</option>
                            </select>
                        </div>
                        <div class="m-search-item">
                            <button class="button">立即搜索</button>
                        </div>
                    </div>
                    <div class="m-search-handle">
                        <a href="{{ url('/admin/manage/recharge_static') }}" class="button bg-success">
                            <i class="bx bx-pie-chart-alt-2"></i>付费统计
                        </a>
                        <a href="{{ url('/admin/users/users_withdrawals') }}" class="button bg-warning">
                            <i class="bx bx-wallet"></i>客户提现记录
                        </a>
                        <a href="{{ url('/admin/users/users_invoice') }}" class="button bg-primary">
                            <i class="bx bx-credit-card-alt"></i>发票申请记录
                        </a>
                    </div>
                </form>
                @endif
                <div class="self-table-responsive">
                    <table class="table table-bordered table-nowrap">
                        <thead>
                            <tr>
                                @if(Auth::user()->authority == 3)
                                <th scope="col">用户</th>
                                <th scope="col">账号</th>
                                @endif
                                <th scope="col">产品名称</th>
                                <th scope="col">金额</th>
                                <th scope="col">状态</th>
                                <th scope="col">支付方式</th>
                                <th scope="col">开始时间</th>
                                <th scope="col">结束时间</th>
                                <th scope="col">支付单号</th>
                                @if(Auth::user()->authority == 3)
                                <th scope="col">邀请码</th>
                                <th scope="col">关键词</th>
                                <th scope="col">操作</th>
                                @endif
                            </tr>
                        </thead>
                        <tbody>
                            @forelse($memberorders as $memberorder)
                            <tr>
                                @if(Auth::user()->authority == 3)
                                <td><img src="{{ asset($memberorder->avatar) }}" style="width: 30px;height: 30px;border-radius: 50%;margin-right: 5px;">{{ mb_strlen($memberorder->nike) > 6 ? mb_substr($memberorder->nike, 0, 6)."...":$memberorder->nike }}</td>
                                <td>{{ empty($memberorder->username) ? "-" : $memberorder->username }}</td>
                                @endif
                                @if(Auth::user()->authority == 3)
                                <td>{{ $memberorder->name }}</td>
                                @else
                                <td>{{ str_replace("(我方)","",$memberorder->name) }}</td>
                                @endif
                                <td>{{ $memberorder->price }}</td>
                                @if($memberorder->pay_status == 1)
                                <td class="text-primary">未支付</td>
                                @elseif($memberorder->pay_status == 2)
                                <td class="text-primary">待支付</td>
                                @elseif($memberorder->pay_status == 3)
                                <td class="text-success">已支付</td>
                                @elseif($memberorder->pay_status == 4)
                                <td class="text-success">已续费</td>
                                @else
                                <td class="text-danger">已退款</td>
                                @endif
                                @if($memberorder->type == 1)
                                <td class="text-success">微信</td>
                                @elseif($memberorder->type == 2)
                                <td class="text-primary">支付宝</td>
                                @elseif($memberorder->type == 3)
                                <td>管理员添加</td>
                                @else
                                <td>其他</td>
                                @endif
                                <td>{{ empty($memberorder->start_time) ? "-" : date("Y-m-d H:i:s",$memberorder->start_time) }}</td>
                                <td>{{ empty($memberorder->end_time) ? "-" : date("Y-m-d H:i:s",$memberorder->end_time) }}</td>
                                <td>{{ empty($memberorder->transaction_id) ? '-' : $memberorder->transaction_id }}</td>
                                @if(Auth::user()->authority == 3)
                                <td>{{ empty($memberorder->code) ? '-' :  $memberorder->code }}</td>
                                <td>{{ empty($memberorder->keyword) ? '-' :  $memberorder->keyword }}</td>
                                <td>
                                    <div class="table-handdle-td">
                                        <a href="{{ url('/admin/links_lists/member_orders_update',['id'=>$memberorder->id]) }}" class="table-handdle-link">更新订单</a>
                                        <div class="dropdown-handle table-handdle-menu" data-bs-toggle="dropdown"  aria-expanded="false">
                                            <font>更多操作</font>
                                            <i class="bx bx-chevron-down"></i>
                                        </div>
                                        <div class="dropdown-menu">
                                            <a href="{{ url('/admin/users/users_detial',['users_id'=>$memberorder->users_id]) }}" class="dropdown-item" target="_blank">用户详情</a>
                                            <a href="{{ url('/admin/users/users_qrcode_lists') }}?users_id={{ $memberorder->users_id }}" class="dropdown-item" target="_blank">二维码上传记录</a>
                                            <a href="{{ url('/admin/users/users_update',['users_id'=>$memberorder->users_id]) }}" class="dropdown-item" target="_blank">更新用户信息</a>
                                        </div>
                                    </div>
                                </td>
                                @endif
                            </tr>
                            @empty
                            <tr>
                                @if(Auth::user()->authority == 3)
                                <td colspan="9">当前暂无充值记录！</td>
                                @else
                                <td colspan="6">当前暂无充值记录！</td>
                                @endif
                            </tr>
                            @endforelse
                        </tbody>
                    </table>

                    <div class="pagination-container">
                        {!! $memberorders->appends($condition)->render() !!}
                    </div>
                </div>
                <div class="phone-table-alert"></div>
            </div>
        </div>
    </div>
</div>
@endsection
